/*
** header.h for 42sh in /home/lamais_a//42sh/minishell2-2017-gueux_g/bin
** 
** Made by adrien lamaison
** Login   <lamais_a@epitech.net>
** 
** Started on  Fri Mar 29 17:40:49 2013 adrien lamaison
** Last update Sat Jun 15 14:35:51 2013 julien genoud
*/

#ifndef	       	__HEADER_H__
#define	       	__HEADER_H__

#include       	<sys/wait.h>
#include       	<sys/types.h>
#include       	<sys/stat.h>
#include       	<signal.h>
#include       	<grp.h>
#include       	<pwd.h>
#include       	<unistd.h>
#include       	<stdlib.h>
#include       	<pwd.h>
#include       	<dirent.h>
#include       	<errno.h>
#include       	<time.h>
#include       	"my.h"

typedef struct 	s_arg
{
  int  		save;
  int  		arg;
  int  		count;
}      		t_arg;


typedef struct 	s_path
{
  char 		*environement;
  int  		i;
  int  		count;
  int  		tmp;
  char 		**containt_path;
  char 		*way;
}      		t_path;

typedef	struct 	s_cmd
{
  char 		*s_buff;
  char 		**s_argv;
  char 		*s_cmd;
}      		t_cmd;

typedef	struct	s_pipe
{
  int		p[2];
  int	       	pid;
  int  		statut;
}      		t_pipe;

typedef	struct	s_worldtab
{
  char          **tab;
  int           a;
  int           i;
  int           tmp;
  int           count;
  char          *save;
}      		t_worldtab;

void		aff_env(char **env);
char		**cpy_env(char **env, int nb_arg);
void		check_good_path(t_path *path, char **en);
void		remp_path(t_path *path, char **en);
void		check_path(t_path *path, char **en);
/*i*/int		xstat(char *str, struct stat *sb);
/*i*/int		xopendir(char *str, DIR **drpt);
int		found_str_in_path(t_path *path, char *str);
char		*command(char *str, t_cmd *cmd);
int		my_fork(char *str, t_path *path, char **env);
void		son_process(char *str, t_path *path, char **env);
int		basic_commande(char *str, t_path *path, char **env);
void		init_ptr(int (*ptrfunct[5])(char *, char **));
int		cmd_exit(char *exit_str, char **exit_env);
int		cmd_env(char *aff_env, char **env);
int		cmd_unsetenv(char *exit_to_env, char **env);
int		cmd_setenv(char *put_in_env, char **env);
int		cmd_cd(char *path, char **env);
int		cmd_echo(char *path, char **env);
void		copy_env(char **env, char **en);
int		compaire(char *cmd, char *str);
int		in_env(char *name, char **env);
void		modif_value(char *put_in_env, char **env, int pose, char *name);
char		**new_variable(char **env, char *name, char *value);
int		my_while(t_path *path, char **env);
void		do_nothing(int sig);
char		*my_getenv(char *env_search, char **env);
int		countword(char *str);
char		**my_str_to_wordtab_bultin(char *str);
void		check_sign(char *str, char *sign);
int		simple_command(char *str, t_path *path, char **env);
int		double_cmd(char **multi_commande, t_path *path, char sign, char **env);
void		pp(char **multi_commande, t_path *path, char **env);
void		point_virgule(char **multi_commande, t_path *path, char **env);
char		**cpy_env(char **env, int nb_arg);
char		*remply_equal();
void		recup_name(char **name, char *put_in_env, int *i, int save);
void		recup_var(char **content, char *put_in_env, int *i);


#endif		/*__HEADER_H__*/
